#include "cm0_timer.h"

void TIM_CommonInit(CMSDK_TIMER_TypeDef * TIMx, TIM_InitTypeDef * pTIM){
	TIMx->CTRL = 0;
	
	TIMx->VALUE = pTIM->TIM_Period;
	TIMx->RELOAD = pTIM->TIM_Reload;
	
	TIMx->CTRL |= pTIM->TIM_CounterSource;
	TIMx->CTRL |= pTIM->TIM_CounterStart;
	TIMx->CTRL |= pTIM->TIM_IQR;
	TIMx->CTRL |= pTIM->TIM_CounterCtrl;
}


